package com.aikon.wht.designPattern.consumer;

/**
 * @author haitao.wang http://www.bestwonderful.com
 */
public class TestOfConsumerDP {

    public static void main(String[] args) {
        Product product = new Product();

        Object lock = new Object();


        Producer producer = new Producer("P1", lock, product);

        Consumer consumer = new Consumer("C1", lock, product);
//        new Thread(producer).start();
//            new Thread(consumer).start();

        for (int i = 0; i < 2; i++) {
            new Thread(new Producer("P" + String.valueOf(i), lock, product)).start();
        }
//
        for (int i = 0; i < 3; i++) {
            new Thread(new Consumer("C" + String.valueOf(i), lock, product)).start();
        }
    }
}
